<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>循环语句之while</title>
</head>

<body>

</body>

</html>

<script>
    // while 语句包括一个循环条件和一段代码块，只要条件为真，就不断循环执行代码块

    // while(条件){
    // 代码块
    // }
    var sum = 0;
    var i = 1;
    while(i <= 10){ 
        sum += i;
        i++;
    }
    console.log(sum)

    

</script>